"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
const resizeImage_1 = __importDefault(require("../../lib/resizeImage"));
async function getDataScreenshot(resourceItem) {
    const config = {
        method: 'post',
        url: 'http://127.0.0.1:3005/getDataScreenshot',
        responseType: 'arraybuffer',
        data: resourceItem
    };
    return new Promise((resolve) => {
        (0, axios_1.default)(config)
            .then(async function (response) {
            const inputBuffer = Buffer.from(response.data);
            const outputBuffer = await (0, resizeImage_1.default)(inputBuffer, 400, 400);
            resolve(outputBuffer);
        })
            .catch(function (error) {
            resolve(null);
        });
    });
}
exports.default = getDataScreenshot;
